 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc"%>
<%@ include file="/WEB-INF/inc/script.inc"%>


<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="${base}">
<title>中金通 | 修改项目</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<!-- FooTable -->
<!-- <link href="css/plugins/footable/footable.core.css" rel="stylesheet"> -->
	<!-- summernote -->
<link href="css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
<link href="css/plugins/zyupload/skins/zyupload-1.0.0.min.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="js/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
   <style>
   		.upload_btn{
   			display:none;
   		}
  		.note-editor{
			min-height:0px;
			border: 1px solid #e5e6e7;
		}
		.content-control {
			display: block;
			width: 100%;
			/* padding:6px 12px; */
			line-height: 1.42857143;
			color: #555;
			background-color: #fff;
			background-image: none;
			border: 1px solid #ccc;
			/* border-radius: 4px; */
			-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
			box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
			-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
			-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
			transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
		}
		.content-control.error{
		 	border: 1px dotted #cc5965;
		}
		.content-control.has-success{
			border-color: #1ab394;
			-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
			box-shadow: inset 0 1px 1px rgba(0,0,0,.075)
		}
		.control-label.content-success{
			color:#1ab394;
		}
    </style>
    <script type="text/javascript">
	/* window.onbeforeunload(){ 
	        //用户点击浏览器右上角关闭按钮
	        if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey) { 
	        	
			}//用户点击任务栏，右键关闭
	        else if(event.clientY > document.body.clientHeight || event.altKey){
	        	
	        }
	        else//其他情况为刷新 
	        { 
	        	alert("你在刷新");
	        } 
        }; */
	</script>
</head>

<body onbeforeunload="return CloseEvent();" onunload="UnLoadEvent()">

	<div id="wrapper">

		<!-- 左侧菜单 -->
		<jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>
		<div id="page-wrapper" class="gray-bg">
			<div class="row border-bottom">
				<!-- 头部工具栏区 -->
				<jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
			</div>
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-10">
					<h2>基金经理</h2>
					<ol class="breadcrumb">
						<li><a href="common/platform">Home</a></li>
						<li><a >项目管理</a></li>
						<li class="active"><strong>修改项目</strong></li>
					</ol>
				</div>
				<div class="col-lg-2"></div>
			</div>
			<div class="row" style="margin-top: 10px;">
				<div class="col-md-12">
					<ul class="nav nav-tabs">
			            <li  class="active">
							<a href="#" style="background-color:#fff;border-bottom-color:#fff;">
								修改项目
							</a>
						</li>
			        </ul>
					<div class="tabs-container">
						<div class="tab-content">
							<div class="tab-pane active">
								<div class="panel-body">
									<div class="wrapper wrapper-content animated">
									<div class="row">
                                        <div class="col-lg-12">
                   							 <div class="ibox">
                   							 <div>
									<form action="" method="post" id="addForm"
												enctype="multipart/form-data"  
												class="form-horizontal">
			                           <div class="row">
						                    <div class="col-sm-6">
						                       <div class="form-group">
						                       		 <input type="hidden" name="id" id="projectId" value="${project.id}">
						                           <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>项目名称:</label>
			                                       <div class="col-sm-8">
			                                    	   <input type="text" name="name" class="form-control" placeholder="项目名称" value="${project.name}">
			                                       </div>
						                       </div>
						                    </div>
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                        	<label class="col-sm-2 control-label" style="position:relative;margin-left:-18px;width:19%;"><font color="red">*&nbsp;&nbsp;</font>项目编号:</label>
			                                        <div class="col-sm-8">
			                                    	   <input type="text" name="code" class="form-control" placeholder="项目编号" value="${project.code}">
			                                        </div>
						                        </div>
						                    </div>
						                 </div>
			                             <div class="row">
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>项目类型:</label>
			                                        <div class="col-sm-8">
			                                    	   <select id="type" class="form-control m-b" name="type" >
							                              <option <c:if test="${project.type eq 1}"> selected="selected" </c:if> value="1">债券类</option>
							                              <option <c:if test="${project.type eq 2}"> selected="selected" </c:if> value="2">股权类</option>
							                           </select>
			                                        </div>
						                        </div>
						                    </div>
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                            <label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>企业:</label>
			                                        <div class="col-sm-8">
			                                        	<div class="input-group">
			                                    	   <select id="enterpriseId" class="form-control m-b" name="enterpriseId" >
							                              <c:if test="${enterpriseList.size() != 0}">
             													<c:forEach var="i" begin="0" end="${enterpriseList.size()-1}">
											                	<c:if test="${project.enterpriseId eq enterpriseList.get(i).getId()}">
												                	<option value="${enterpriseList.get(i).getId()}" selected="selected">${enterpriseList.get(i).getName()}</option>
												                </c:if>
												                <c:if test="${project.enterpriseId ne enterpriseList.get(i).getId()}">
												                	<option value="${enterpriseList.get(i).getId()}">${enterpriseList.get(i).getName()}</option>
												               </c:if> 
											                </c:forEach>
										             		</c:if>
							                           </select>
							                           <span class="input-group-btn"> <button type="button" name="addEnterprise" class="btn btn-primary">新增
                                        					</button> </span></div>
			                                        </div>
						                        </div>
						                    </div>
						                 </div>
			                              <div class="row" id="guaranteeTypeDiv">
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>担保方式:</label>
			                                        <div class="col-sm-8">
			                                    	   <select id="guaranteeType" class="form-control m-b" id="guaranteeType" name="guaranteeType" >
							                              <option value="1" <c:if test="${project.guaranteeType eq 1}"> selected="selected" </c:if>>保证</option>
							                              <option value="2" <c:if test="${project.guaranteeType eq 2}"> selected="selected" </c:if>>抵押</option>
							                              <option value="3" <c:if test="${project.guaranteeType eq 3}"> selected="selected" </c:if>>质押</option>
							                              <option value="4" <c:if test="${project.guaranteeType eq 4}"> selected="selected" </c:if>>留质</option>
							                              <option value="5" <c:if test="${project.guaranteeType eq 5}"> selected="selected" </c:if>>定金</option>
							                           </select>
			                                        </div>						                        
		                                        </div>
						                    </div>
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                        	<label class="col-sm-2 control-label" id="guaranteeLabel"><font color="red">*&nbsp;&nbsp;</font>抵押人:</label>
			                                        <div class="col-sm-8">
			                                        	<div class="input-group">
			                                    	   <select id="guaranteeEnterpriseId" class="form-control m-b" name="guaranteeEnterpriseId" >
							                              <c:if test="${enterpriseList.size() != 0}">
             													<c:forEach var="i" begin="0" end="${enterpriseList.size()-1}">
											                	<c:if test="${project.guaranteeEnterpriseId eq enterpriseList.get(i).getId()}">
												                	<option value="${enterpriseList.get(i).getId()}" selected="selected">${enterpriseList.get(i).getName()}</option>
												                </c:if>
												                <c:if test="${project.guaranteeEnterpriseId ne enterpriseList.get(i).getId()}">
												                	<option value="${enterpriseList.get(i).getId()}">${enterpriseList.get(i).getName()}</option>
												                </c:if>
											                </c:forEach>
										             		</c:if>
							                           </select>
							                           <span class="input-group-btn"> <button type="button" name="addEnterprise" class="btn btn-primary">新增
                                        					</button> </span></div>
			                                        </div>
						                        </div>
						                    </div>
						                 </div>
			                             <!-- <div class="hr-line-dashed"></div> -->
			                             <div class="row" id="guaranteeAssessDiv">
						                    <div class="col-sm-12">
												<div class="form-group">
													<label class="col-sm-2 control-label" id="guaranteeAssessLabel"><font
														color="red">*&nbsp;&nbsp;</font>抵押物状况/评估:</label>
													<div class="col-sm-8">
														<textarea id="guaranteeAssess" name="guaranteeAssess" class="form-control"
															placeholder="抵押物状况/评估(1-1000字)" rows="10">${project.guaranteeAssess}</textarea>
													</div>
												</div>
			                                </div>
						                 </div>
			                             <!-- <div class="hr-line-dashed"></div> -->
			                              <div class="row">
			                              	<div class="col-sm-6">
						                        <div class="form-group">
						                        	<label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>项目金额:</label>
			                                       <div class="col-sm-8">
			                                    	   <input type="text" name="amount" class="form-control" placeholder="项目金额" value="${project.amount}">
			                                       </div>
						                        </div>
						                    </div>
						                    <div class="col-sm-6">
						                        <div class="form-group">
						                            <label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>风控经理:</label>
			                                        <div class="col-sm-8">
			                                    	   <select id="incomeType" class="form-control m-b" name="lawEmployeeId" >
							                              <c:if test="${approveRoleGroupMemberList.size() != 0}">
             													<c:forEach var="i" begin="0" end="${approveRoleGroupMemberList.size()-1}">
											                	<c:if test="${project.lawEmployeeId eq enterpriseList.get(i).getId()}">
												                	<option value="${approveRoleGroupMemberList.get(i).getId()}" selected="selected">${approveRoleGroupMemberList.get(i).getEmpName()}</option>
												                </c:if>
												                <c:if test="${project.lawEmployeeId ne enterpriseList.get(i).getId()}">
												                	<option value="${approveRoleGroupMemberList.get(i).getId()}">${approveRoleGroupMemberList.get(i).getEmpName()}</option>
												                </c:if>
											                	</c:forEach>
										             		</c:if>
										             		<option value="1">1</option>
							                           </select>
			                                        </div>
						                        </div>
						                    </div>
						                 </div> 
			                            <div class="row">
			                            	<div class="col-sm-12">
												<div class="form-group">
													<label class="col-sm-2 control-label" id="content-label"><font
														color="red">*&nbsp;&nbsp;</font>项目简介:</label>
													<div class="col-sm-8">
					                                    <div class="ibox-content no-padding">
						                                    <div class="summernote" id="introduction" class="form-control">
						                                    ${project.introduction}
						                                    </div>
					                                   		<label id="contents-error" class="error" style="display:none" for="content">内容不能为空</label>
					                                    </div>
				                                	</div>
												</div>
			                                </div>
			                            </div>
			                            <div class="row"> 
			                            	<div class="col-sm-12">
												<div class="form-group">
													<label class="col-sm-2 control-label" id="content-label1"><font
														color="red">*&nbsp;&nbsp;</font>融资方案:</label>
													<div class="col-sm-8">
					                                    <div class="ibox-content no-padding">
						                                    <div class="summernote" id="plan" class="form-control">
						                                    ${project.plan}
						                                    </div>
					                                   		<label id="contents-error1" class="error" style="display:none" for="content">内容不能为空</label>
					                                    </div>
				                                	</div>
												</div>
			                                </div>
			                            </div>
			                           <!--   <div class="row"> 
			                            	<div class="col-sm-6">
						                       <div class="form-group">
						                           <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>项目附件:</label>
			                                       <div class="col-sm-8">
			                                    	   <div id="zyupload" class="zyupload"></div>  
			                                       </div>
						                       </div>
						                    </div>
					                    </div> -->
					                   <div class="row" style="padding-left:17px">
										    <div class="col-sm-6">
										        <div class="form-group">
										            <label class="col-sm-4 control-label">项目附件:</label>
										             <div id="relatedFileId" class="col-sm-8">
										        		<c:forEach items="${projectAttachmentList}" var="file">
										       			    <div style="padding-top:2px;" id="${file.id}">
										        			    ${file.contractName}
										        			    &nbsp;<button  type="button"  class="btn btn-outline btn-primary btn-xs" onclick="deleteThisFile(this)">
																    删除
																</button>
																<button id="${file.id}" name="${file.contractName}" type="button" class="btn btn-outline btn-primary btn-xs" onclick="showRenameDialog(this)">重命名</button>
										        			</div>
														</c:forEach>
										            </div>
										        </div>
										    </div> 
										  </div>
								          <div class="row" style="padding-left:17px">
											  <div class="col-sm-6">
											      <div class="form-group">
											          <label class="col-sm-4 control-label">上传文件</label>
											          <div class="col-sm-6">
											          	   <input id="relatedFile" class="btn btn-outline btn-primary" type="file" name="relatedFile" accept=".xls,.xlsx,.doc,.docx,.txt,.pdf,.ppt,.pptx">
											          	   <div  style="padding-top:2px"><input class="btn btn-outline btn-primary" type="button" value="上传" onclick="uploadRelatedFile()"></div>
											          </div>
											      </div>
											 </div> 
										</div>  
										<div class="hr-line-dashed"></div>
		                              	<div class="form-group">
		                                  <div class="col-sm-4 col-sm-offset-5">
		                                      <button class="btn btn-white" type="reset" id="cancleAbout">取 消</button>
		                                      <button class="btn btn-primary" id="submit_manager" type="submit">更 新</button>
		                                  </div>
		                              	</div>
									</form>
									</div>
									</div>
								</div>
							</div>
						</div>
						</div>
						</div>
						</div>
					</div>
				</div>
			</div>
			
											<!-- 项目附件重命名 -->
												<div class="modal inmodal fade" id="updateModel_relatedFile" tabindex="-1" role="dialog"  aria-hidden="true">
					                                <div class="modal-dialog modal-lg">
					                                    <div class="modal-content">
					                                        <div class="modal-header">
					                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					                                            <h4 class="modal-title">重命名</h4>
					                                        </div>
					                                        <div class="modal-body">
					                                        <div id="updateBody_relatedFile"></div>
					                                        <div class="form-horizontal">
					                                			<div class="form-group">
					                                				<label class="col-sm-2 control-label">文件原名</label>
					                                    			<div class="col-sm-8">
					                                    				<input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" id="o_renameFileName" class="form-control" >
					                                				</div>
					                                			</div>
					                                			<div class="form-group">
					                                				<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>文件新名</label>
					                                    			<div class="col-sm-8">
					                                    				<input type="text" id="renameFileName" class="form-control" >
					                                            	</div>
					                                			</div>
					                                			<span id="renameInfo" class="col-sm-2 control-label"></span>
					                                       </div>
																
					                                        </div>
					                                        <div class="modal-footer">
					                                            <button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
					                                            <button type="button" class="btn btn-primary" onclick="renameFile();">保 存</button>
					                                        </div>
					                                    </div>
					                                </div>
					                            </div>
					                            <!--项目附件重命名 end -->
					                             
			<!-- 底部版权 -->
			<jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>
		</div>
	</div>
	<!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/plugins/jquery-ui/jquery-ui.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/plugins/jeditable/jquery.jeditable.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.messages-zh_CN.js" type="text/javascript"></script>

	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<!-- Data picker -->
	<script src="js/laydate-master/laydate.js"></script>
	<!-- Clock picker -->
	<script src="js/jquery.tmpl.min.js"></script>
	<script src="js/ajaxfileupload.js"></script>
	<script src="js/jquery.form.js"></script>
	
    
 	<script src="js/project/project-update.js?v=${jsVersion}"></script>
 	<!-- SUMMERNOTE -->
    <script src="js/plugins/summernote/summernote.min.js"></script>
    <!-- zyupload -->
    <script src="js/plugins/zyupload/zyupload.basic-1.0.0.js"></script>
    <script>
    function deleteRelatedFileSign(obj){
    	var nRow = $(obj).parents('div')[0];
    	nRow.parentNode.removeChild(nRow);        
    }
    </script>
	<script>
		$(document).ready(function() {
			
			ProjectUpdate.init();
			var selected = $('#type').children('option:selected').val(); 
			var guaranteeTypeDiv = $('#guaranteeTypeDiv');
			var guaranteeAssessDiv = $('#guaranteeAssessDiv');
			if (2 == selected){
				guaranteeTypeDiv.css('display','none');
				guaranteeAssessDiv.css('display','none');
			} else {
				guaranteeTypeDiv.css('display','block');
				guaranteeAssessDiv.css('display','block');
			};
			var selected = $('#guaranteeType').children('option:selected').val(); 
			var obj = $('#guaranteeLabel');
			var guaranteeAssessDiv = $('#guaranteeAssessDiv');
			var guaranteeAssessLabel = $('#guaranteeAssessLabel');
			switch (selected) {
            case ("1"):
            		obj.html('<font color="red">*&nbsp;&nbsp;</font>保证人:');
					guaranteeAssessDiv.css('display','none');
                break;
            case ("2"):
                	obj.html('<font color="red">*&nbsp;&nbsp;</font>抵押人:');
            		guaranteeAssessDiv.css('display','block');
            		guaranteeAssessLabel.html('<font color="red">*&nbsp;&nbsp;</font>抵押物状况/评估:')
                break;
            case ("3"):
                	obj.html('<font color="red">*&nbsp;&nbsp;</font>质押人:');
            		guaranteeAssessDiv.css('display','block');
            		guaranteeAssessLabel.html('<font color="red">*&nbsp;&nbsp;</font>质押物状况/评估:')
                break;
            case ("4"):
            		obj.html('<font color="red">*&nbsp;&nbsp;</font>留置人:');
	                guaranteeAssessDiv.css('display','block');
	        		guaranteeAssessLabel.html('<font color="red">*&nbsp;&nbsp;</font>备注:')
                  break;
            case ("5"):
            		obj.html('<font color="red">*&nbsp;&nbsp;</font>缴款人:');
	                guaranteeAssessDiv.css('display','block');
	        		guaranteeAssessLabel.html('<font color="red">*&nbsp;&nbsp;</font>备注:')
                  break;
            default:
			};
		});
		/* var DispClose = true;
        function CloseEvent()
        {
        var content = $('.summernote').code();
        if (((content.trim() != '' && content.trim() != "<p><br></p>")) && DispClose )
        {
        return "是否要刷新或离开？\n确定放弃修改直接退出？";
        }
        } */
        
      /*   function UnLoadEvent()
        {
        DispClose = false;
        //在这里处理关闭页面前的动作
        } */
	</script>

</body>

</html>
